/*
 * @Author: spark
 * @Date: 2021-06-28 14:14:07
 * @LastEditTime: 2021-06-28 17:05:57
 * @LastEditors: spark
 * @Description: 一个持续与bug做抗争的程序员
 * email: spark.xiaoyu@qq.com
 */
import { ModuleTypes } from '@/store'

export enum ActionTypes {
    ACTION_GET_USERINFO = "ACTION_GET_USERINFO",
    ACTION_SET_TOKEN = "ACTION_SET_TOKEN",
    ACTION_LOGIN_OUT = 'ACTION_LOGIN_OUT'
}

const someKey = enumKeysAsString(ActionTypes);

export type ActionTypesNamespaced = `${ModuleTypes.userModule}/${typeof someKey}`


function enumKeysAsString<TEnum>(theEnum: TEnum): keyof TEnum {
    const keys = Object.keys(theEnum).filter(x =>
        (+x) + "" !== x) as (keyof TEnum)[];
    return keys[Math.floor(Math.random() * keys.length)];
}